close all;
clear all;
clc;

%Generieren der Daten
data = zeros(50000,1);
for i=1:50000
    data(i)=normrnd(10,sqrt(4));
end

sample_size=[5 30 100 500];

mu = zeros(4,100);
varianz = zeros(4,100);

hmean= figure;
hvar = figure;

for j=1:4
%Sampling
    for i=1:100
        one_sample = randsample(data,sample_size(j));
             
        mu(j,i) = mean(one_sample);
        varianz(j,i) = var(one_sample);
    end
    %Plot means
    figure(hmean);
    subplot(2,2,j);
    hist(mu(j,:));
    title(['Sample size: ' num2str(sample_size(j))]);
    axis([7 13 0 40]);
    figure(hvar);
    subplot(2,2,j);
    hist(varianz(j,:));
    axis([0 15 0 30]);
    title(['Sample size: ' num2str(sample_size(j))]);
end


%Auswertung
